<admintpl file="header" />
</head>
<body>
<div class="wrap js-check-wrap">
	<ul class="nav nav-tabs">
		<li><a href="{:U('Finance/systurnover_see')}">营业收入查看</a></li>
	</ul>
	<form class="form-horizontal js-ajax-form" action="{:U('Finance/systurnover_see')}" method="post">
		<div class="row-fluid">
			<div>
				<h4 style="color: #f50">订单明细</h4>
			</div>
			<div class="span12">
				<php>$order_types=array("1"=>'取送订单',"2"=>'代买订单',"3"=>'代排队订单');
					$order_status=array("0"=>'未处理',"1"=>'待分配',"2"=>'已分配',"3"=>'已到达',"4"=>'已拍照',"5"=>"已取件","6"=>"已送达","7"=>"已完成","9"=>'已取消');
					$pay_methods=array("1"=>'支付宝',"2"=>'微信',"3"=>'钱包');
					$pay_status=array("0"=>'未支付',"1"=>'已支付',"2"=>'已退款');
					$yesno=array("0"=>'否',"1"=>'是');
					$cancel_part=array("1"=>'用户',"2"=>'派单员');
				</php>
				<table class="table table-bordered" style="width:80%">
					<tr>
						<th style="width: 10%;text-align: right">订单号:</th>
						<td  style="width: 20%;">{$data.orderid|getOrderNo}
						</td>
						<th style="width: 10%;text-align: right">用户姓名:</th>
						<td style="width: 20%;">{$data.uid|getUserName}
						</td>
						<th style="width: 15%;text-align: right">跑客团队:</th>
						<td  style="width: 20%;">{$data.company_id|getCompanyName}
						</td>

					</tr>
					<tr>
						<th style="width: 10%;text-align: right">订单类型:</th>
						<td >{$order_types[$data[order_type]]}
						</td>
						<th  style="width: 10%;text-align: right">支付方式:</th>
						<td >{$pay_methods[$data[pay_method]]}
						</td>
						<th  style="width: 10%;text-align: right">跑客姓名:</th>
						<td >{$data.dispatch_id|getDispatchName}
						</td>


					</tr>
					<tr>
						<th style="text-align: right">订单时间:</th>
						<td >{$data.order_time}
						</td>
						<th style="text-align: right">订单总里程:</th>
						<td>{$data.total_mileage}公里
						</td>
						<th  style="text-align: right">跑客电话:</th>
						<td >{$data.dispatch_id|get_dispatch_mobile}
						</td>

					</tr>
					<tr>
						<th style="text-align: right">是否预约单:</th>
						<td>{$yesno[$data[is_reservation]]}
						</td>
						<th style="text-align: right">是否指派单:</th>
						<td>
							{$yesno[$data[is_appoint]]}
						</td>
						</td><th  style="text-align: right">物品类型:</th>
						<td >{$data[res_type]}
						</td>
					</tr>

					<tr>
						<th  style="text-align: right" >订单金额:</th>
						<td >{$data.ordermoney}元
						</td>
						<th  style="text-align: right">用户实付:</th>
						<td>{$data[real_amount]}元
						</td>
						<th  style="text-align: right">跑腿费:</th>
						<td>{$data[dispatch_get_money]}元
						</td>

					</tr>
					<tr>
						<th  style="text-align: right" >优惠券面值:</th>
						<td>{$data[uid]|getCouponValue=$data[orderid],###}元
						</td>
						<th  style="text-align: right">加急金额:</th>
						<td><if condition="$data[insured_amount] == null || $data[insured_amount]==''">0.00</else>{$data[insured_amount]}</if>元
						</td>
						<th  style="text-align: right">小费:</th>
						<td>{$data[fee]}元
						</td>

					</tr>
					<tr>
						<th  style="text-align: right" >优惠金额:</th>
						<td>{$data[uid]|getOrderCoupon=$data[orderid],###}元
						</td>

						<th style="text-align: right">保险金额:</th>
						<td><if condition="$data[insurance_amount] == null || $data[insurance_amount]==''">0.00</else>{$data[insurance_amount]}</if>元
						</td>
						<if condition="$data[order_type]==2">
							<th  style="text-align: right">代购商品金额:</th>
							<td >{$data[goods_amount]}元
							</td>
							<else/>
							<th  style="text-align: right"> </th>
							<td >
							</td>
						</if>

					</tr>


				</table>
			</div>
			<div>
				<h4 style="color: #f50">营业收入明细</h4>
			</div>
			<div class="span12">
				<php>$recommend_amount = getRecommendPn($data[orderid],$data[dispatch_id]);//推荐跑客奖励
					$recommend_separate = $data[total_income]-$data[separate_income];//推荐用户分成
				</php>
				<table class="table table-bordered" style="width:80%">
					<tr>
						<th  style="width: 10%;text-align: right">入账时间:</th>
						<td style="width: 20%;">{$data.time}
						</td>
						<th  style="width: 10%;text-align: right">订单实收:</th>
						<td style="width: 20%;">{$data[real_amount]}元
						</td>
						<th   style="width: 15%;text-align: right">代购商品金额:</th>
						<td style="width: 20%;">{$data[goods_amount]}元
						</td>
					</tr>
					<tr>
						<th  style="text-align: right" >订单金额:</th>
						<td >{$data.ordermoney}元
						</td>
						<th  style="text-align: right">支付跑客:</th>
						<td>{$data[dispatch_get_money]}元
						</td>
						<th  style="text-align: right">账面应收:</th>
						<td>{$data[total_income]}元
						</td>

					</tr>
					<tr>
						<th  style="text-align: right" >优惠券面值:</th>
						<td >{$data[uid]|getCouponValue=$data[orderid],###}元
						</td>
						<th  style="text-align: right">支付分成:</th>
						<td >{$data[recommend_separate]}元
						</td>
						<th  style="text-align: right">账面实收:</th>
						<td>{$data[separate_income]}元
						</td>
					</tr>
					<tr>
						<th  style="text-align: right" >优惠金额:</th>
						<td>{$data[uid]|getOrderCoupon=$data[orderid],###}元
						</td>

						<th style="text-align: right">支付推荐:</th>
						<td>{$recommend_amount}元
						</td>

						<th  style="text-align: right">实际收入:</th>

							<if condition="$data[order_type]==2">
						<td >{$data[real_amount]-$data[dispatch_get_money]-$recommend_separate-$recommend_amount-$data[goods_amount]}元
						</td>
						<else/>
						<td >{$data[real_amount]-$data[dispatch_get_money]-$recommend_separate-$recommend_amount}元
						</td>
						</if>
					</tr>
				</table>
			</div>
		</div>
		<if condition="$recommend_users != null ">
			<div>
				<h4 style="color: #f50">用户推荐用户分成</h4>
			</div>
			<div>
				<table class="table table-hover table-bordered" style="width:80%">
					<thead>
					<tr>
						<th align="center">ID</th>
						<th>推荐用户级别</th>
						<th>推荐用户姓名</th>
						<th>用户类型</th>
						<th>分成金额</th>
					</tr>
					</thead>
					<tbody><php>
						$type_names = array('1'=>'普通用户','2'=>'跑客');

					</php>
					<foreach name="recommend_users" item="vo"  key="k" >
						<tr><php>
							$levelName=array("level1"=>'第一级',"level2"=>'第二级',"level3"=>'第三级');
						</php>
							<td align="center">{$vo.person_id}</td>
							<td align="center">{$levelName[$k]}</td>
							<td>{$vo.person_id|getUserNameForType=###,$vo['person_type']}</td>
							<td>{$type_names[$vo['person_type']]}</td>
							<td>{$data['orderid']|getUserSeparateIncome=$vo['person_id'],$vo['person_type']}元</td>
						</tr>
					</foreach>
					</tbody>
				</table>
			</div>
		</if>

		<div class="form-actions">
			<a class="btn" href="{:U('Finance/systurnover_list')}">{:L('BACK')}</a>
		</div>

	</form>


</div>
<script src="__PUBLIC__/js/common.js"></script>

</body>
</html>
